home *** CD-ROM | disk | FTP | other *** search
- /* XGStdIcon.cpp
- *
- * This is the engine for handling drawing color icons
- */
-
- /* YAAF - Yet another application framework
- * Copyright (C) 1997 William Edward Woody and In Phase Consulting
- *
- * This library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Library
- * General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or any
- * later version.
- *
- * This library is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Library General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Library General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * To contact the author, either e-mail me at
- * woody@alumni.caltech.edu, or write to us at
- *
- * William Edward Woody
- * In Phase Consulting
- * 1545 Ard Eevin Avenue
- * Glendale, CA 91202
- */
-
- #include <XStdImage.h>
-
- /************************************************************************/
- /* */
- /* Construction/Destruction */
- /* */
- /************************************************************************/
-
- /* XGStdIcon::XGStdIcon
- *
- * Standard picture initialization
- */
-
- XGStdIcon::XGStdIcon(XGView *p, XGArgStream &i) : XGView(p,i)
- {
- Init(i.GetInteger());
- }
-
- XGStdIcon::XGStdIcon(XGView *p, XGSImageInitRecord &i) : XGView(p,i.v)
- {
- Init(i.image);
- }
-
-
- /* XGStdIcon::~XGStdIcon
- *
- * Fry this
- */
-
- XGStdIcon::~XGStdIcon()
- {
- #if OPT_MACOS == 1
- if (fColor) {
- if (fCIcon) DisposeCIcon(fCIcon);
- } else {
- if (fIcon) ReleaseResource(fIcon);
- }
- #endif
- }
-
- /************************************************************************/
- /* */
- /* Image Drawing */
- /* */
- /************************************************************************/
-
- /* XGStdIcon::DoDrawView
- *
- * Draw the picture
- */
-
- void XGStdIcon::DoDrawView(Rect)
- {
- #if OPT_MACOS == 1
- Rect r;
- XGDraw draw(this);
-
- r = GetContentRect();
- if (fColor) {
- if (fCIcon) ::PlotCIconHandle(&r,0,0,fCIcon);
- } else {
- if (fIcon) ::PlotIconHandle(&r,0,0,fIcon);
- }
- #endif
- }
-
- /************************************************************************/
- /* */
- /* Image Drawing */
- /* */
- /************************************************************************/
-
- /* XGStdIcon::Init
- *
- * My initialization routine
- */
-
- void XGStdIcon::Init(short resID)
- {
- #if OPT_MACOS == 1
- fCIcon = GetCIcon(resID);
- if (fCIcon) fColor = true;
- else {
- fColor = false;
- fIcon = GetIcon(resID);
- }
- #endif
- }
-